How to deploy Hardocs using GitHub pages
- Create a bash script named
deploy
at the root of your repository. - Copy the code below and
After all your local changes are done and committed, check that everything is ready for deployment:
- Change the
.env file
so that the entries correspond to your project information:
GITHUB_USERNAME="your github user name"
REPOSITORY=" the github repository name"
Create a branch named "gh-pages" and merge the master repository into that branch
Create the deploy.sh file at the root of your repository, copy the code below, set the proper repository address and uncomment the script based on your use case.
#!/bin/bash
# abort on errors
set -e
# load .env
eval "$(cat .env <(echo) <(declare -x))"
# build
yarn build
# navigate into the build output directory
cd docs/.vuepress/dist
git init
git add -A
git commit -m 'deploy'
# if you are deploying under a user then do:
# git push -f https://github.com/<USERNAME>/<REPO>.git master:gh-pages
# if you are deploying under an organization then do:
# git push -f https://github.com/<ORGNAME>/<REPO>.git master:gh-pages
cd -
Now run the script to create a deployable branch "gh-pages"
bash deploy.sh